#include "vector/one_hot_test.h"

#include "vector/one_hot.h"
#include "log.h"
#include "tools/measure_execution_time.h"

void OneHotTest::test()
{
    std::vector<uint8_t> labels{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    auto one_hot_labels = OneHot::encode(labels, 10);
    LogInfo() << "labels: " << labels;
    LogInfo() << "one_hot_labels: " << one_hot_labels;
}


void OneHotTest::performance_test()
{
    std::vector<uint8_t> labels{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};

    int64_t epochs{1000000};
    std::vector<std::vector<uint8_t>> one_hot_labels{};
    std::vector<uint8_t> labels_decode{};
    
    MEASURE_EXECUTION_TIME("OneHotTest", epochs, {
        one_hot_labels = OneHot::encode(labels);
        labels_decode = OneHot::decode(one_hot_labels);
    });

    MEASURE_CPU_TIME("OneHotTest", epochs, {
        one_hot_labels = OneHot::encode(labels);
        labels_decode = OneHot::decode(one_hot_labels);
    });
}